/**
 * npm install --save mockjs
 */
import Mock from 'mockjs'

Mock.mock('/api/documents/tagRules', 'post', function (option) {
    // 这里的option是请求的相关参数
    console.log(JSON.stringify(option))
    console.log(option.body);
    let arr = option.body.split("=");
    console.log(arr[1]);
    if (arr[1] === 'civil') {
        //return ...
        //return Mock.mock()
        return {data:[
            {
                "options": [
                    {
                        "value": 1,
                        "label": "自然人"
                    },
                    {
                        "value": 2,
                        "label": "公司"
                    }
                ],
                "field": "委托人类型",
                "title": "委托人类型",
                "type": "radio",
                "value": ""
            },
            {
                "options": [
                    {
                        "value": 3,
                        "label": "自然人"
                    },
                    {
                        "value": 4,
                        "label": "公司"
                    }
                ],
                "field": "对方类型",
                "title": "对方类型",
                "type": "radio",
                "value": ""
            },
            {
                "options": [
                    {
                        "value": 5,
                        "label": "原告"
                    },
                    {
                        "value": 6,
                        "label": "被告"
                    },
                    {
                        "value": 7,
                        "label": "上诉人"
                    },
                    {
                        "value": 8,
                        "label": "被上诉人"
                    },
                    {
                        "value": 9,
                        "label": "再审申请人"
                    },
                    {
                        "value": 10,
                        "label": "再审被申请人"
                    },
                    {
                        "value": 11,
                        "label": "执行申请人"
                    },
                    {
                        "value": 12,
                        "label": "执行被申请人"
                    },
                    {
                        "value": 13,
                        "label": "有独立请求权第三人"
                    },
                    {
                        "value": 14,
                        "label": "无独立请求权第三人"
                    }
                ],
                "field": "委托人诉讼地位",
                "title": "委托人诉讼地位",
                "type": "radio",
                "value": ""
            }
        ]};
    }
    else if(arr[1] === 'lawsuit'){return {data: [
        {
            "emitPrefix": "ld",
            "field": "类型选择",
            "options": [
                {
                    "value": 16,
                    "label": "董事会"
                },
                {
                    "value": 17,
                    "label": "临时股东大会"
                },
                {
                    "value": 18,
                    "label": "年度股东大会"
                },
                {
                    "value": 19,
                    "label": "监事会"
                },
                {
                    "value": 20,
                    "label": "职工大会"
                }
            ],
            "type": "checkbox",
            "title": "类型选择",
            "emit": [
                {
                    "name": "on-change",
                    "inject": {
                        "docType": "lawsuit"
                    }
                }
            ],
            "value": []
        }
    ]}};
})

Mock.mock('/api/documents/tagId', 'post', function (option) {
    // 这里的option是请求的相关参数
    console.log(JSON.stringify(option))
    console.log(option.body);
    let arr1 = option.body.split("=");
    console.log(arr1[1]);
    if (arr1[1] === 'high') {
        return {
    data: [
        {
            "value": 34,
            "label": "高频合同"
        }
    ]}}

    else if (arr1[1] === 'limited') {
            return {
                data: [
        {
            "value": 28,
            "label": "有限公司非诉讼常用"
        }
    ]}}})

